// Very dangerous. Must go duipai.
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a),i##__END__=(b);i<=i##__END__;++i)
#define drep(i,a,b) for (int i=(a),i##__END__=(b);i>=i##__END__;--i)
using namespace std;
using ll = long long;

void ofile(string s){ // remember!!!
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}

int n,a[100010],sum,p,res=0;

int main(){
  ofile("duel");
  scanf("%d",&n);
  rep(i,1,n){
    int x;
    scanf("%d",&x);
    ++a[x];
  }
  sum=n;
  rep(i,1,100000){
    sum-=a[i];
    p=max(0,p-a[i]);
    res+=min(sum-p,a[i]);
    p+=min(sum-p,a[i]);
  }
  printf("%d\n",n-res);
  return 0;
}